#include <iostream>
#include <unistd.h>
#include <pthread.h>
void *run(void *args)
{
    while (true)
    {
        std::cout << "new thread, pid: " << getpid() << std::endl;
        sleep(1);
    }
}

int main()
{
    std::cout << "我是一个线程,pid: " << getpid() << std::endl;
    pthread_t tid;
    pthread_create(&tid, nullptr, run, (void *)"pthread-1");
    while (true)
    {
        std::cout << "new thread, pid: " << getpid() << std::endl;
        sleep(1);
    }
}